package java_basic.t1_objectandclasses;

public class MethodOverloadDemo {

	void sumOfParams(){ //First version
		System.out.println("No parameter");
	}
	
	void sumOfParams(int a){//Second version
		System.out.println("One parameter: " + a);
	}
	
	int sumOfParams(int a, int b){ //Third version
		System.out.println("Two parameter: " + a + " , " + b);
		return a + b;
	}
	
	double sumOfParams(double a, double b){ //Fourth version
		System.out.println("Two double parameter: " + a + " , " + b);
		return a+b;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		MethodOverloadDemo moDemo = new MethodOverloadDemo();
		int intResult;
		double doubleResult;
		
		moDemo.sumOfParams();
		System.out.println();
		
		moDemo.sumOfParams(2);
		System.out.println();
		
		intResult = moDemo.sumOfParams(10, 20);
		System.out.println("Sum is " + intResult);
		System.out.println();
		
		doubleResult = moDemo.sumOfParams(1.1, 2.2);
		System.out.println("Sum is : " + doubleResult);
		System.out.println();
		
	}

}
